<?php
require_once('common.php');
?>
<style>
    a{
        text-decoration: none;
        color:#666;
        font-size: 16px;
        font-family: consolas, PingFang SC, Microsoft YaHei;
        margin: 0px 20px;
        text-shadow: 0px 0px 1px white;
    }
    a:hover{
        text-decoration: underline;
    }
    body,html{
        text-align: center;
        padding-top: 200px;
        background-color: #f5f5f5;
    }
</style>
<?php
foreach ($oauthList  as $_plat=>$_config){
	$redirect_uri=urlencode(REDIRECT_URL ."?plat=".$_plat);
	switch ($_plat){
		case  'gitee':
			echo "<a href='https://gitee.com/oauth/authorize?client_id=".$_config['id']."&redirect_uri={$redirect_uri}&response_type=code'>".$_config['title']."</a>";
			break ;
		case  'qq':
			echo "<a href='https://graph.qq.com/oauth2.0/authorize?client_id=".$_config['id']."&redirect_uri={$redirect_uri}&response_type=code&state=".sha1(rand(100000,999999))."'>".$_config['title']."</a>";
			break ;
		case  'oschina':
			echo "<a href='https://www.oschina.net/action/oauth2/authorize?client_id=".$_config['id']."&redirect_uri={$redirect_uri}&response_type=code'>".$_config['title']."</a>";
			break ;
		case  'github':
			echo "<a href='https://github.com/login/oauth/authorize?client_id=".$_config['id']."&redirect_uri={$redirect_uri}&response_type=code'>".$_config['title']."</a>";
			break ;
		default :
			break ;
	}
}
?>